package com.hotel.service.impl;

import com.hotel.mapper.QtMapper;
import com.hotel.pojo.User;
import com.hotel.service.QtService;
import com.hotel.vo.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class QtServiceImpl implements QtService {

    @Autowired
    private QtMapper qtMapper;

    @Override
    public List<User> findAll() {
        return qtMapper.findAll();
    }

    @Override
    public PageResult getQtList(PageResult pageResult) {
        Long total = qtMapper.getTotal();
        int size = pageResult.getPageSize();
        int start = (pageResult.getPageNum()-1)*size;
        String query = pageResult.getQuery();
        List<User> rows= qtMapper.findQtListByPage(start,size,query);
        return pageResult.setTotal(total).setRows(rows);
    }

    @Override
    public void deleteQt(Integer qtId) {

    }
}
